<#-- @ftlvariable name="todoList" type="java.util.List<nxu.it.model.Todo>" -->
<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>待办事项列表</title>
    <style>
        .is-complete {
            text-decoration: line-through;
        }
    </style>
</head>
<body>
<form action="/todo/save" method="post">
    <div class="field">
        <label for="content">内容</label>
        <input type="text" id="content" name="content" placeholder="请输入待办事项" />
        <input type="submit" value="新建">
    </div>
</form>
<table>
    <tr>
        <th>编号</th>
        <th>内容</th>
        <th>完成情况</th>
        <th>操作</th>
    </tr>
    <#list todoList as todo>
        <tr>
            <td>${todo.id}</td>
            <td<#if todo.complete> class="is-complete"</#if>>${todo.content}</td> <!-- 修改这里 -->
            <td><input type="checkbox" ${todo.complete?string('checked', '')} onchange="checkTodo(${todo.id});"></td>
            <td>
                编辑
                删除
                <!--编辑
                删除-->
            </td>
        </tr>
    </#list>
</table>
</body>
<script>
    function checkTodo(id){
        window.location.href = '/todo/check/'+ id;
    }
</script>
</html>